Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 4 - Colors and Color-Related Objects / Colors and Color-Related Objects Reference
Constants and Data Types


Color Packing

You can store color values according to their standard definitions, or in packed format to save space. QuickDraw GX recognizes six kinds of color-value storage, defined in the gxColorPackingTypes enumeration:

enum gxColorPackingTypes{
   gxNoColorPacking     = 0x0000,
   gxAlphaSpace         = 0x0080,
   gxWord5ColorPacking  = 0x0500,
   gxLong8ColorPacking  = 0x0800,
   gxLong10ColorPacking = 0x0a00,
   gxAlphaFirstPacking  = 0x1000 
};
Constant descriptions

gxNoColorPacking
No packing applied; colors are stored with 16 bits per component.
gxAlphaSpace
An alpha channel is included in the color description. The alpha component follows the other components in storage.
gxWord5ColorPacking
Colors are stored with 5 bits per component. Unused bits in the storage space are the high-order bits.
gxLong8ColorPacking
Colors are stored with 8 bits per component. Unused bits in the storage space are the high-order bits.
gxLong10ColorPacking
Colors are stored with 10 bits per component. Unused bits in the storage space are the high-order bits.
gxAlphaFirstPacking
An alpha channel is included in the color description. The alpha component precedes the other components in storage.
The color-packing values are flags that are added to color-space definitions to define different kinds of packed color spaces. Note that the specification of an alpha channel in a color space is achieved with a color-packing flag. To see how these values are applied to the definitions of color spaces, see the section "Color Spaces," next.

When QuickDraw GX converts from an unpacked color space to a packed color space, the color-component values are truncated (low-order bits lost) to fit the packed format. When QuickDraw GX converts from a packed color space to an unpacked color space, the color-component values are shifted leftward (padded with zeros in the low-order bits) to fit the unpacked format.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996